; *** Burmese chess
; *** Copyright 1998-2002 Zillions Development
; v.2.0

; You need to purchase Zillions of Games to load this rules file
; Visit the Zillions web site at http://www.zillions-of-games.com

(version "2.0")
(translate 
 ("Sittuyin 1" "缅甸象棋 - 布局一") ("Sittuyin 2" "缅甸象棋 - 布局二")
 ("Sittuyin 3" "缅甸象棋 - 布局三") ("Sittuyin 4" "缅甸象棋 - 布局四")
 ("Sittuyin 5" "缅甸象棋 - 布局五") ("Sittuyin 6" "缅甸象棋 - 布局六")
 ("Sittuyin 7" "缅甸象棋 - 布局七") ("Sittuyin 8" "缅甸象棋 - 布局八")
 ("White""白方")("Black" "黑方")
 ("Pawn" "兵") ("Knight"  "马")
 ("Elephant" "象") ("Chariot" "车")
 ("General"  "士") ("King" "王")
)
   
(define shift        ($1 (verify not-friend?) add) )
(define shift2       ($1 $2 (verify not-friend?) add) )
(define slide        ($1 (while empty? add $1) (verify not-friend?) add))
(define diagonal-promotion
   (if (and (on-board? $1) (not-friend? $1) (not-piece? General $1))
      $1
	  (if (not (or (and (enemy? nw) (piece? King nw))
	               (and (enemy? ne) (piece? King ne))
               )
          )
        (add General)
      )
	  back
   )
)
(define Pawn-move (
   n
   (verify empty?)
   add
))
(define Pawn-capture (
   $1
   (verify enemy?)
   add
))
(define Pawn-promote (
   (verify (in-zone? promotion-zone))
   (add General)
   (diagonal-promotion ne)
   (diagonal-promotion nw)
   (diagonal-promotion se)
   (diagonal-promotion sw)
))

(game
   (title "Sittuyin 1")
   (description "缅甸象棋类似国际象棋，但走法和其他规则与国际象棋不同。如：\
	兵只能走一格。\兵只能升变为士，且必须是己方士已阵亡的场合。\兵的升级线在对方阵内画斜线的格子。\除兵以外，其余的棋子可以自由布置在兵阵后面。\没有王车易位，也不允许逼对方无路可走。\\本游戏提供了八个布局供对下。")
   (history "Burmese Chess (Sittuyin) is a close relative of Thai Chess (Makruk).
      It is not played very much any more, except in
      `tea-houses in the north-west, particularly round Bhamo and Katha.`")
   (strategy "There is a Burmese saying that the Elephant and General should
      never be separated.  Burmese players do not like to exchange their
	  Elephants.   Promotion is much less important than in orthodox chess.
        Relative values of the pieces:\\
	  Pawn - General - Elephant - Knight - Chariot")
   (option "recycle promotions" true)
   (option "recycle captures" true)
   (option "prevent flipping" 2)
   (music "")
   (opening-sound "Audio\\Asian.wav")
   (click-sound "Audio\\Pickup.wav")
   (release-sound "Audio\\WoodThunk.wav")
   (players White Black)
   (turn-order White Black)

   (board
      (image "images\Chess\Sittuyin.bmp")
      (grid
         (start-rectangle 5 5 52 52)
         (dimensions
             ("a/b/c/d/e/f/g/h" (49 0)) ; files
             ("8/7/6/5/4/3/2/1" (0 49)) ; ranks
         )
         (directions (n 0 -1) (e 1 0) (s 0 1) (w -1 0)
			         (ne 1 -1) (nw -1 -1) (se 1 1) (sw -1 1)
         )
      )
      (symmetry Black (n s)(s n) (nw sw)(sw nw) (ne se)(se ne))
      (zone
         (name promotion-zone)
         (players White)
         (positions a8 b7 c6 d5 e5 f6 g7 h8)
      )
      (zone
         (name promotion-zone)
         (players Black)
         (positions a1 b2 c3 d4 e4 f3 g2 h1)
      )
   )

   (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King g2)
         (Elephant d2 g3)
         (Knight f2 f3)
         (General e3)
         (Chariot c1 e1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King c7)
         (Elephant c6 e7)
         (Knight d7 f7)
         (General d6)
         (Chariot e8 g8)
      )
   )

   (piece
      (name Pawn)
      (image White "images\Chess\SHaag\wpawn.bmp"  "images\Chess\wpawn.bmp"
             Black "images\Chess\SHaag\bpawn.bmp"  "images\Chess\wpawn.bmp")
	  (help "兵：向前一格，吃子需斜前一格。对方阵内大斜线上升级成士")
	  (description "兵(缅甸语Ne)\\只能向前一格，只能斜前一格吃子。\在本方士已阵亡的场合，若兵到达对方半盘的画斜线的格子，则需要花一步棋升变为士。升变一个满足条件的兵可以让其原地升变，或斜走一格再升变。兵一旦走过升级区，则无法升变。")
      (moves
         (Pawn-capture nw)
         (Pawn-capture ne)
         (Pawn-move)
		 (Pawn-promote)
      )
   )
   (piece
      (name Knight)
      (image White "images\Chess\SHaag\wknight.bmp" "images\Chess\wknight.bmp"
             Black "images\Chess\SHaag\bknight.bmp" "images\Chess\bknight.bmp")
	  (help "马：同国象马")
	  (description "马(缅甸语Myin)\\走日字，即先横2步再竖1步，或先横1步再竖两步。可以越子。")
      (moves
	     (shift2 n ne)
	     (shift2 n nw)
	     (shift2 s se)
	     (shift2 s sw)
	     (shift2 e ne)
	     (shift2 e se)
	     (shift2 w nw)
	     (shift2 w sw)
      )
   )
   (piece
      (name Elephant)
      (image White "images\Chess\SHaag\wbishop.bmp" "images\Chess\wbishop.bmp"
             Black "images\Chess\SHaag\bbishop.bmp" "images\Chess\bbishop.bmp")
	  (help "象：斜走一格，或向前一格")
	  (description "象(缅甸语Sin)\\走法与将棋的银将相同，即可以斜走一格，或者向前一格。")
      (moves
         (shift ne)
         (shift nw)
         (shift se)
         (shift sw)
		 (shift n)
      )
   )
   (piece
      (name Chariot)
      (image White "images\Chess\SHaag\wrook.bmp" "images\Chess\wrook.bmp"
             Black "images\Chess\SHaag\brook.bmp" "images\Chess\brook.bmp")
	  (help "车：直走不限格数。")
	  (description "车(缅甸语Yattah)\\横竖均可，不限格数。")
      (moves
         (slide n)
         (slide e)
         (slide s)
         (slide w)
      )
   )
   (piece
      (name General)
      (image White "images\Chess\SHaag\wqueen.bmp" "images\Chess\wqueen.bmp"
             Black "images\Chess\SHaag\bqueen.bmp" "images\Chess\bqueen.bmp")
	  (help "General: steps 1 square diagonally")
	  (description "士(缅甸语Sit-ke)\\只能斜走一格。")
      (moves
         (shift ne)
         (shift nw)
         (shift se)
         (shift sw)
      )
   )
   (piece
      (name King)
      (image White "images\Chess\SHaag\wking.bmp" "images\Chess\wking.bmp"
             Black "images\Chess\SHaag\bking.bmp" "images\Chess\bking.bmp")
	  (help "王：八方一格，被将死输。")
	  (description "王(缅甸语Min-gyis)\\横、竖或斜走一格均可。被将死输。")
      (moves
         (shift n)
         (shift e)
         (shift s)
         (shift w)
         (shift ne)
         (shift nw)
         (shift se)
         (shift sw)
         
      )
   )
   (loss-condition (White Black) (checkmated King) )
   (win-condition (White Black) stalemated)
)

; ********************************** VARIANTS

(variant
  (title "Sittuyin 2")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King c2)
         (Elephant b2 d2)
         (Knight e2 f3)
         (General e3)
         (Chariot f1 g1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King c7)
         (Elephant c6 e7)
         (Knight b6 d7)
         (General d6)
         (Chariot f8 g8)
      )
   )
)

(variant
  (title "Sittuyin 3")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King f2)
         (Elephant d2 f3)
         (Knight e2 g3)
         (General e3)
         (Chariot b1 c1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King c7)
         (Elephant c6 f7)
         (Knight d7 e7)
         (General d6)
         (Chariot e8 g8)
      )
   )
)

(variant
  (title "Sittuyin 4")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King f2)
         (Elephant c2 f3)
         (Knight e2 d2)
         (General e3)
         (Chariot b1 d1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King b7)
         (Elephant b6 e7)
         (Knight c6 d7)
         (General d6)
         (Chariot c8 f8)
      )
   )
)

(variant
  (title "Sittuyin 5")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King g2)
         (Elephant d2 g3)
         (Knight e2 f3)
         (General e3)
         (Chariot c1 f1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King b7)
         (Elephant b6 e7)
         (Knight c6 c7)
         (General d6)
         (Chariot d8 f8)
      )
   )
)

(variant
  (title "Sittuyin 6")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King f2)
         (Elephant d2 f3)
         (Knight e2 c2)
         (General e3)
         (Chariot b1 d1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King c8)
         (Elephant c7 g7)
         (Knight d6 d7)
         (General c6)
         (Chariot e8 f8)
      )
   )
)

(variant
  (title "Sittuyin 7")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King f1)
         (Elephant b2 f2)
         (Knight e2 e3)
         (General f3)
         (Chariot c1 d1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King b7)
         (Elephant b6 c6)
         (Knight e7 c7)
         (General d6)
         (Chariot d8 f8)
      )
   )
)

(variant
  (title "Sittuyin 8")
  (board-setup
      (White
         (Pawn a3 b3 c3 d3 e4 f4 g4 h4)
         (King g2)
         (Elephant f3 g3)
         (Knight d2 f2)
         (General e3)
         (Chariot c1 e1)
      )
      (Black
         (Pawn a5 b5 c5 d5 e6 f6 g6 h6)
         (King b7)
         (Elephant b6 e7)
         (Knight c6 c7)
         (General d6)
         (Chariot d8 f8)
      )
   )
)
